package com.example.event;

import com.example.constant.MqConstants;
import com.example.entity.OrderReturnApply;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.UUID;

@Component
public class RefundEvent extends BaseEvent<OrderReturnApply> {
    private final String topic = MqConstants.Exchange.ORDER_EXCHANGE;
    private final String routingKey = MqConstants.Key.ORDER_REFUND_KEY;

    @Override
    public EventMessage<OrderReturnApply> buildEventMessage(OrderReturnApply data) {
        return EventMessage.<OrderReturnApply>builder()
                .data(data)
                .id(UUID.randomUUID().toString())
                .timestamp(new Date())
                .build();
    }

    @Override
    public String topic() {
        return topic;
    }

    @Override
    public String routingKey() {
        return routingKey;
    }
}
